<script type="text/javascript">
	$(document).ready(function() {
		$("#selecctall").change(function() {
            if($(this).is(':checked')){
				$(".checkbox1").prop("checked",true);
			}
			else{
				$(".checkbox1").prop("checked",false);
			}
        });
    });
	function DeleteAllData(){
		var r=confirm("Bạn có muốn xóa không?!");
		if (r==true)
        {	   
    		$(".checkbox1").each(function() {
    		    if($(this).is(':checked')){
                    var id = $(this).val();
                    deleteItem(id);
                }
            });
        }
	}
    function deleteData(url,id){
		var r=confirm("Bạn có muốn xóa không?!");
		if (r==true)
		  {
			var linkUrl = url;
        	var Id = id; 
			$.ajax({
				type:"POST",
				url:linkUrl,
				success: function(data){
					if(data="ok"){
						$(".list_"+Id).fadeOut("slow");
					}
				}
			});
		  }	
    }
    function deleteItem(id){
		var linkUrl = "<?php echo base_url();?>quantri/ngon-ngu/del/"+id;
		$.ajax({
			type:"POST",
			url:linkUrl,
			success: function(data){
				if(data="ok"){
					$(".list_"+id).fadeOut("slow");
				}
			}
		});
    }    
</script>
<div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"><?php echo $title;?></h1>
                    <a onclick="DeleteAllData()" class="add-icon"><img src="<?php echo base_url();?>public/admin/images/del-icon.png"/></a>
                    <a href="<?php echo base_url();?>quantri/ngon-ngu/add" class="add-icon"><img src="<?php echo base_url();?>public/admin/images/add-icon.png"/></a>                    
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <?php echo $title_table;?>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <?php
                                    echo "<label for='disabledSelect' style='color:red;'>".$this->session->flashdata('message')."</label>";
                            ?>                        
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th><input type="checkbox" id="selecctall"/></th>
                                            <th>Tên ký tự</th>
                                            <th>Tên ngôn ngữ</th>
                                            <th>Thao tác</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                            foreach($data as $row){
                                                ?>
                                                <tr class="odd gradeX list_<?php echo $row['id']; ?>">
                                                    <td  width="5%">
                                                    	<input type="checkbox" value="<?php echo $row['id']; ?>" class="checkbox1" />
                                                    </td>
                                                    <td><?php echo $row['name']; ?></td>
                                                    <td><?php echo $row['title']; ?></td>
                                                    <td class="center" width="10%" >
                                                        <a href="<?php echo base_url();?>quantri/ngon-ngu/edit/<?php echo $row['id']; ?>" class="edit_item"><img src="<?php echo base_url();?>public/admin/images/edit-icon.png" /></a>
                                                        <a  onclick="deleteData('<?php echo base_url();?>quantri/ngon-ngu/del/<?php echo $row['id']; ?>','<?php echo $row['id']; ?>')" class="del_item" ><img src="<?php echo base_url();?>public/admin/images/icon_del.gif" /></a>
                                                    </td>
                                                </tr>                                                
                                                <?php
                                            }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
                
</div>
<!-- /#page-wrapper -->

